﻿using GraphProcessor;
using IQIGame.Onigao.Logic;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [System.Serializable, NodeMenuItem(LevelEditorConst.Execution + "/" + LevelEditorConst.ChangeWeather, typeof(LevelServiceGraph))]
    public class LevelServiceExecutionNode_ChangeWeather : LevelServiceExecutionNode
    {
        protected override ServiceExecutionType mServiceType => ServiceExecutionType.ChangeWeather;

        public override string name => LevelEditorConst.ChangeWeather;
        [LevelServiceEditorCustomProperty(ServiceExecutionType.ChangeWeather, "天气id"), Tooltip("0表示全局，局部id参考编辑器功能")]
        public int id;
        [LevelServiceEditorCustomProperty(ServiceExecutionType.ChangeWeather, "天气类型"), Tooltip("隐藏填0，显示的数值待定")]
        public int type;

        protected override LevelServiceCustomConfig CreateConfig()
        {
            var rConfig = new LevelServiceExecutionCustom_ChangeWeather()
            {
                id = this.id,
                type = this.type
            };
            return rConfig;
        }
        
        protected override void OnSync(EditorLevelServiceExecutionConfig newConfig, LevelServiceExecutionNode tempNode)
        {
            if (tempNode is LevelServiceExecutionNode_ChangeWeather rNode)
            {
                this.id = rNode.id;
                this.type = rNode.type;
            }
        }
    }
}